﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Interfaces;
using Microsoft.Practices.Unity;
using PCSWpfClient.ViewModel;
using PCSWpfData;

namespace PCSWpfClient.Locator
{
    class MainWindowModelLocator
    {
        static MainWindowModelLocator()
        {
            Container = new UnityContainer();
            Container.RegisterType<IRepository, SelectionCriteria>();

            // register as a singleton
            Container.RegisterType<MainWindowViewModel>(new ContainerControlledLifetimeManager());
        }

        public static IUnityContainer Container
        {
            get;
            private set;
        }

        public MainWindowViewModel MainVM
        {
            get
            {
                var vm = Container.Resolve<MainWindowViewModel>();
                return vm;
            }
        }
    }
}
